<template>
  <div class="row-box vux-1px-b">
    <div class="p-thumb">
      <img @click="$router.push('/courses/' + product.id)" :src="$apiUrl + '/storage/' + product.thumb">
      <!-- <i class="iconfont icon-bofang"></i> -->
    </div>
    <div class="p-info">
      <div class="p-name">
       {{product.name}}
      </div>
      <div class="p-count">
        <i class="iconfont icon-icon-"></i> <span> {{product.pv}}</span>
        <i class="iconfont icon-time"></i> <span> {{product.length_of_time}}分钟</span>
        <i class="iconfont icon-pinglun"></i> <span> {{product.comment_count}}</span>
      </div>
      <div class="teacher">
        <span class="price" v-if="product.price > 0">￥{{product.price}}</span>
        <span class="price" v-if="product.price <= 0">免费</span>
        <span class="fanli" v-if="product.bonus_ratio_1 > 0 || product.bonus_ratio_2 > 0">返利</span>
        <span class="name" v-if="product.user">{{product.user.name}}老师</span>
      </div>
    </div>
  </div>
</template>
<script>
  import { XButton, Badge } from 'vux'
  export default {
    name: 'row',
    components: {
      XButton,
      Badge
    },
    data () {
      return {
      }
    },
    computed: {
    },
    props: {
      product: {
        type: Object,
        required: true
      }
    }
  }
</script>
<style scoped lang='less'>
  .row-box {
    display: flex;
    justify-content:space-between;
    height: 100px;
    padding-bottom: 10px;
    padding-top: 10px;
  }
  .row-box img {
    width: 130px;
    height: 100px;
    padding-right: 10px;
  }
  .row-box .p-info {
    display: flex;
    flex-direction: column;
    justify-content:space-between;
    flex-grow: 1;
  }
  .p-name {
    height: 22px;
    overflow: hidden;
  }
  .p-count {
    color: #999;
    font-size: 12px;
  }
  .teacher {
    color: #ff6700;
    display: flex;
    justify-content: space-between;
    .fanli {
      font-size: 12px;
      border: 1px solid #e02e24;
      color: #e02e24;
      line-height: 12px;
      height: 12px;
      padding: 3px 5px;
      opacity: .6;
      border-radius: 10px;
    }
    .name {
      color: #449fe7;
      font-size: 14px;
    }
  }
  .p-thumb {
    position: relative;
    .iconfont {
      position: absolute;
      left: 50px;
      top: 35px;
      font-weight: bold;
      font-size: 30px;
      color: #fff;
    }
  }
  
</style>